package com.ytjj.qmyx.supplychain.common.enums;

import lombok.Getter;

/**
 * @Description 聚水潭订单状态
 * @ClassName JushuitanOrderStatusEnum
 *
 * 
 * @Version 1.0
 **/

@Getter
public enum JushuitanOrderStatusEnum {

    WAIT_BUYER_PAY("WAIT_BUYER_PAY", "等待买家付款"),
    WAIT_SELLER_SEND_GOODS("WAIT_SELLER_SEND_GOODS", "等待卖家发货"),
    WAIT_BUYER_CONFIRM_GOODS("WAIT_BUYER_CONFIRM_GOODS", "等待买家确认收货"),
    TRADE_FINISHED("TRADE_FINISHED", "交易成功"),
    TRADE_CLOSED("TRADE_CLOSED", "付款后交易关闭"),
    TRADE_CLOSED_BY_TAOBAO("TRADE_CLOSED_BY_TAOBAO", "付款前交易关闭")
    ;


    /**
     * 聚水潭订单状态
     */
    private String code;

    /**
     * 聚水潭订单状态
     */
    private String message;

    JushuitanOrderStatusEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getMessageByCode(Integer code){
        for (JushuitanOrderStatusEnum value : JushuitanOrderStatusEnum.values()) {
            if(value.getCode().equals(code)){
                return value.getMessage();
            }
        }
        return null;
    }

    public static String getCodeByMessage(String message){
        for (JushuitanOrderStatusEnum value : JushuitanOrderStatusEnum.values()) {
            if(value.getMessage().equals(message)){
                return value.getCode();
            }
        }
        return null;
    }
}
